public class Demo3_2 {
    //模拟实现ToString
    public static String myToString(int[] arr1) {
        if(arr1==null) {
            return null;
        }
        if(arr1.length==0) {
            return "[]";
        }
        String ret="[";
        for (int i = 0; i < arr1.length; i++) {
            ret=ret+arr1[i];
            if(i!= arr1.length-1) {
                ret+=", ";
            }
        }
        ret+="]";
        return ret;
    }
    public static void main(String[] args) {
        int[] arr={1,2,3,4,5};
        String ret = myToString(arr);
        System.out.println(ret);
    }
}
